import Cookies from 'js-cookie';
import Config from '@/settings';

const TokenKey = Config.TokenKey;
const USERUUID = Config.UserUUID;
const USERNAMEKEY = Config.UserName;
const USERROLESKEY = Config.UserRoles;

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token, rememberMe) {
  if (rememberMe) {
    return Cookies.set(TokenKey, token, { expires: Config.tokenCookieExpires });
  } else return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

export function getUserID() {
  return Cookies.get(USERUUID);
}

export function setUserID(userId) {
  return Cookies.set(USERUUID, userId);
}

export function removeUserID() {
  return Cookies.remove(USERUUID);
}
export function getUserName() {
  return Cookies.get(USERNAMEKEY);
}

export function setUserName(UserName) {
  return Cookies.set(USERNAMEKEY, UserName);
}

export function removeUserName() {
  return Cookies.remove(USERNAMEKEY);
}
export function getUserRoles() {
  return Cookies.get(USERROLESKEY);
}

export function setUserRoles(userRoles) {
  return Cookies.set(USERROLESKEY, userRoles);
}

export function removeUserRoles() {
  return Cookies.remove(USERROLESKEY);
}
